﻿using System;
using Newtonsoft.Json;

namespace AutoR.Helpers
{
	// Token: 0x02000242 RID: 578
	public class BoolConverter : JsonConverter
	{
		// Token: 0x06000D74 RID: 3444 RVA: 0x00073AE6 File Offset: 0x00071CE6
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			writer.WriteValue(((bool)value) ? 1 : 0);
		}

		// Token: 0x06000D75 RID: 3445 RVA: 0x00073AFC File Offset: 0x00071CFC
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			try
			{
				return Convert.ToBoolean(Convert.ToInt32(reader.Value));
			}
			catch (Exception)
			{
			}
			return null;
		}

		// Token: 0x06000D76 RID: 3446 RVA: 0x00073ACC File Offset: 0x00071CCC
		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(bool);
		}
	}
}
